package com.springboot.experiment2;

import org.springframework.boot.CommandLineRunner;
import org.springframework.core.env.Environment;

import java.util.Objects;

/**
 * author 陈伯瑞
 * date 2020/4/9 0009 13:49
 * version 1.0
 **/
@SuppressWarnings("unused")
public class CustomerCommandLineRunner implements CommandLineRunner {

    Environment env;

    public CustomerCommandLineRunner(Environment env) {
        this.env = env;
    }

    @Override
    public void run(String... args) throws Exception {
        System.out.println("利用springboot 自动装配的CommandLineRunner。");
        System.out.println("生成一个随机字符串:".concat(Objects.requireNonNull(env.getProperty("random."))));
    }
}

